﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;

namespace QRCodeCreator
{
    /// <summary>
    /// Interaction logic for FrmMyTcpServerConsole.xaml
    /// </summary>
    public partial class FrmMyTcpServerConsole : Window
    {
        /// <summary>
        /// 整体程序关闭
        /// </summary>
        public bool IsShutdownApplication { get; set; }

        public FrmMyTcpServerConsole()
        {
            InitializeComponent();
            initEvent();
        }

        void initEvent()
        {
            this.Closing += Frm_Closing;
        }

        private void Frm_Closing(object sender, System.ComponentModel.CancelEventArgs e)
        {
            // 遇到的坑 !!!!!!!!! 整个程序关闭时, 需要预留开关让窗体正常关闭, 不然进程会一直挂在系统的
            if (IsShutdownApplication == false)
            {
                e.Cancel = true;
                this.Hide();
            }
        }
    }
}
